package org.catlabs.patterns.jobserver.subject;

import java.util.Observable;

public class WeatherData extends Observable {

	private float temperature;
	private float humidity;
	private float pressure;

	public WeatherData() {
	}

	public float getTemperature() {
		return temperature;
	}

	public float getHumidity() {
		return humidity;
	}

	public float getPressure() {
		return pressure;
	}

	/**
	 * Class state is affected from other classes through this method.
	 * 
	 * @param temp
	 * @param humidity
	 * @param pressure
	 */
	public void setMeasurements(float temp, float humidity, float pressure) {
		this.temperature = temp;
		this.humidity = humidity;
		this.pressure = pressure;

		measurementsChanged();
	}

	/**
	 * This is what the class does after the object state is affected.
	 */
	public void measurementsChanged() {
		setChanged();	// Sets the internal 'modified' flag to true
		notifyObservers();
	}

}
